﻿using System;
using System.Collections.Generic;
using System.Linq;

using SharedGenomics.Core;
using SharedGenomics.Annotations;

namespace SharedGenomics.Workbench.Annotations
{
    public abstract class AnnotationRequestResult
    {
        private IList<AnnotationValue> _annotationValues;

        public AnnotationRequestResult(AnnotationKey key, object rootValue)
        {
            key.ThrowIfNull("key");
            rootValue.ThrowIfNull("rootValue");

            this.Key = key;
            this.RootValue = rootValue;

            this._annotationValues = new List<AnnotationValue>();
        }

        protected void AddValue(AnnotationValue value)
        {
            value.ThrowIfNull("value");
            this._annotationValues.Add(value);
        }

        public AnnotationKey Key { get; private set; }
        public IAnnotation Annotation { get; protected set; }
        public AnnotationRequestStatus Status { get; protected set; }
        public object RootValue { get; private set; }

        public IEnumerable<AnnotationValue> Values
        {
            get { return this._annotationValues.ToArray(); }
        }
    }
}
